﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XWord.Fundamental.Domain;
using Caliburn.PresentationFramework.ApplicationModel;
using System.Windows.Data;
using Caliburn.Core.Metadata;
using XWord.Common;
using Caliburn.PresentationFramework.Metadata;
using System.Windows;
using Microsoft.Practices.ServiceLocation;
using XWord.Fundamental.Domain.Model;
using System.Collections;
namespace XWord.GUI.Presenters
{
    [PerRequest(typeof(CategoryEditPresenter))]
    public class CategoryEditPresenter : Presenter
    {
        private IServiceLocator _serviceLocator;
       

        public CategoryEditPresenter(IServiceLocator serviceLocator)
        {
            _serviceLocator = serviceLocator;
          
        }

        public void InitializeEditEntity()
        {
           
        }

        private string _selectedItem;
        public string SelectedItem
        {
            get { return _selectedItem; }
            set
            {
                _selectedItem = value;
                NotifyOfPropertyChange("SelectedItem");
            }
        }

        public bool IsCanceled { get; set; }

        public bool IsNew { get; set; }

        public void Save()
        {
            //if (IsNew)
            //    ParentPresenter.CategoryList.Add(Entity);
            //ParentPresenter.Model.SaveCategory(Entity);
            //_editingObjectAdapter.EndEdit();
            CloseWindow();
        }

        public void Cancel()
        {
            IsCanceled = true;
            CloseWindow();
        }

        private void CloseWindow()
        {
            this.GetView<Window>(null).Close();
        }
    }
}
